// Copyright (c) 2022 Presto Labs Pte. Ltd.
// Author: lucasyoo

#include <gflags/gflags.h>
#include <spdlog/async.h>
#include <spdlog/sinks/basic_file_sink.h>
#include <spdlog/sinks/rotating_file_sink.h>
#include <spdlog/spdlog.h>

#include <ctime>
#include <sstream>

#include "coin2/base/time.h"
#include "coin2/strategy/hamm/hamm.h"

DEFINE_string(driver, "", "driver config");
DEFINE_string(config, "", "strategy config");

int main(int argc, char* argv[]) {
  gflags::ParseCommandLineFlags(&argc, &argv, true);
  auto path = std::experimental::filesystem::path(FLAGS_driver);
  coin2::app::DriverConfig app_config;
  app_config.MergeFrom(coin2::base::config::DriverConfigFromJson(path));
  ::coin2::base::InitLogging(argv[0], app_config.log());

  coin2::strategy::hamm::HammStrategy strategy(
      FLAGS_config,
      GetCurrentTimestamp());
  coin2::app::Driver driver(app_config, &strategy);
  driver.RegisterCleanupHandler();
  driver.Run();
  return 0;
}
